<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopOrderDetailTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_order_detail', function (Blueprint $table) {
            $table->increments('id')->comment("ID");
            $table->integer("order_id")->comment("订单ID");
            $table->string("order_sn",50)->comment("订单号");
            $table->integer("goods_id")->comment("商品ID");
            $table->integer("class_id")->comment("类型ID");
            $table->string("class_name")->comment("类型名称");
            $table->string("goods_name",100)->comment("商品名称");
            $table->string("image",150)->comment("商品图片");
            $table->decimal("price",10,2)->default(0.00)->comment("单价");
            $table->integer("num")->default(1)->comment("数量");
            $table->integer("sku_id")->nullabe()->comment("规格ID");
            $table->string("sku_name",50)->nullable()->comment("规格名称");
            $table->decimal('sku_price',10,2)->nullable()->comment("规格价格");
            $table->decimal("amount",10,2)->default(0.00)->comment("合计金额");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_order_detail');
    }
}
